package com.example.demo.dto.process;

import org.springframework.util.StringUtils;

public class AddCourseDto {
    private Integer course_code_id;
    private String course_name;
    private Integer semester;
    private Integer teacher_id;
    private Integer class_id;

    public Integer getCourse_code_id() {
        return course_code_id;
    }

    public void setCourse_code_id(Integer course_code_id) {
        this.course_code_id = course_code_id;
    }

    public String getCourse_name() {
        return course_name;
    }

    public void setCourse_name(String course_name) {
        this.course_name = course_name;
    }

    public Integer getSemester() {
        return semester;
    }

    public void setSemester(Integer semester) {
        this.semester = semester;
    }

    public Integer getTeacher_id() {
        return teacher_id;
    }

    public void setTeacher_id(Integer teacher_id) {
        this.teacher_id = teacher_id;
    }

    public Integer getClass_id() {
        return class_id;
    }

    public void setClass_id(Integer class_id) {
        this.class_id = class_id;
    }
    // 参数校验
    public String checkOut(){
        if(!StringUtils.hasLength(this.course_name)){
            return "课程名不得为空";
        }
        if(this.semester == null || this.semester < 0){
            return "学期填写有误";
        }
        if(this.teacher_id == null || this.teacher_id < 2000 ||this.teacher_id > 4999){
            return "教师编号有误";
        }
        if(this.class_id == null || this.class_id < 0){
            return "课程id有误";
        }
        return "";
    }
}
